package com.fy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fy.pojo.entity.FileShare;
import com.fy.pojo.vo.file.FileShareResultVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface FileShareMapper extends BaseMapper<FileShare> {

    /**多表联查获取响应数据
     *
     * @param fileShareId
     * @return
     */
    FileShareResultVO getFileShareResult(String fileShareId);

    /**查询过期时间
     *
     * @param fileId
     * @return
     */
    @Select("select expire_time from file_share where share_id=#{fileId}")
    String selectShareExpireTimeById(String fileId);

    /**更新分享文件浏览次数
     *
     * @param shareId
     */
    @Update("update file_share set show_count=show_count+1 where share_id=#{shareId}")
    void updateShowCountById(String shareId);
}
